<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>商城订单</title>
    <link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
    <style>
        html,
        body {
            background: #F7F7F7;
        }

        .aui-bar-nav {
            background: #0689FB;
        }

        .list_wrap {
            position: relative;
        }

        .list_item {
            margin: 0.5rem 0.75rem;
            border: 1px solid #EFEFEF;
        }

        .shop_item {
            padding: 0.3rem;
        }

        .goodsPic {
            width: 2.5rem;
            height: 2.5rem;
        }

        .row_flex {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .store_name {
            font-size: 0.8rem;
            color: #2F9AF6;
        }

        .order_num {
            font-size: 0.6rem;
            color: #B6B6B6;
        }

        .order_time {
            font-size: 0.5rem;
            color: #B6B6B6;
        }

        .pay_price {
            font-size: 0.7rem;
            color: #B6B6B6;
        }

        .pay_price>span {
            color: #2F9AF6;
        }

        .border_b {
            border-bottom: 1px solid #EFEFEF;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="list_wrap">
            <template v-for="item,index in list">
                <div class="list_item" >
                    <div class=" border_b" style="padding:0.2rem 0.3rem;">
                        <div class="store_name aui-ellipsis-1">{{item.foods[0].shop_name}}</div>
                        <div class="order_num">订单编号：{{item.sn}}</div>
                    </div>

                    <div class="shop_list" v-for="o,i in item.foods">
                        <div class="shop_item row_flex border_b">
                            <div class="aui-margin-r-10"><img class="goodsPic" :src="o.pic" alt=""></div>
                            <div class="row_flex" style="flex:1;">
                                <div class='aui-ellipsis-2' style="width:50%;font-size:0.7rem;">{{o.gname}}</div>
                                <div>*{{o.num}}</div>
                                <div>￥{{o.price}}</div>
                            </div>
                        </div>
                    </div>
                    <!-- <div class="shop_list">
                        <div class="shop_item row_flex border_b">
                            <div class="aui-margin-r-10"><img class="goodsPic" src="../../../image/image3.png" alt=""></div>
                            <div class="row_flex" style="flex:1;">
                                <div class='aui-ellipsis-2' style="width:50%;font-size:0.7rem;">实木吊柜美式柜卫浴镜柜</div>
                                <div>*1</div>
                                <div>￥398.00</div>
                            </div>
                        </div>
                    </div> -->
                    <div class="row_flex" style="padding:0.8rem 0.3rem;">
                        <div class="order_time">下单时间：{{item.create_time}}</div>
                        <div class="pay_price">支付金额：<span>￥{{item.total_price}}</span></div>
                    </div>
                </div>
            </template>

        </div>
    </div>



</body>
<script src="../../../script/api.js" charset="utf-8"></script>
<script src="../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {},

            list: [],
            listType: 1,
            listPage: 1,
            listStatus: true,
        },
        methods: {
            init() {
                this.userInfo = get_local("userInfo");

                this.upDownLoad();
                this.getList();
            },
            getList() {
                var that = this;
                var data = {
                    user_id: this.userInfo.user_id,
                    pages: that.listPage
                };
                _ajax(Config.api.OrderIndex, data, function(ret) {
                    if (ret.code === 200) {
                        if (that.listPage === 1) {
                            that.list = ret.data;
                        } else {
                            if (ret.data.length > 0) {
                                that.list = that.list.concat(ret.data);
                            } else {
                                that.listStatus = false;
                            }
                        }
                    }
                });
            },
            goPay(o) {
                var name = "pay_order_win";
                var url = "./pay_order_win.html";
                open_w(name, url, o);
            },
            upDownLoad() {
                var that = this;
                // 下拉刷新
                push_down(function() {
                    //下拉刷新恢复
                    push_down_over();

                    that.list = [];
                    that.listPage = 1;
                    that.listStatus = true;
                    that.getList();
                });

                //上拉加载
                push_up(function() {
                    if (that.listStatus) {
                        that.listPage++;
                        that.getList();
                    }
                });
            },
        }
    });
</script>

</html>
